<!doctype html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>欢迎登陆</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/login.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="./lib/layui/layui.js" charset="utf-8"></script>
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="login-bg">

<div class="login layui-anim layui-anim-up">
    <div class="message">采购评标专家抽签系统</div>
    <div id="darkbannerwrap"></div>
    <form method="post" class="layui-form"><!--action="userlogin" method="post"-->
        <input name="userName" placeholder="请输入用户名" type="text" lay-verify="required" class="layui-input">
        <hr class="hr15">
        <input name="password" lay-verify="required" placeholder="请输入密码" type="password" class="layui-input">
        <hr class="hr15">
        <input value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
        <div style="color: #00FF00;margin-left: auto;margin-right: auto" id="loginmsg"></div>
        <hr class="hr20">
    </form>
</div>

<script>
    $(function () {
        layui.use(['form', 'layer', 'jquery', 'laydate'],
            function () {
                $ = layui.jquery;
                var form = layui.form,
                    laydate = layui.laydate,
                    layer = layui.layer;
                //监听提交
                form.on('submit(login)', function (data) {
                    $.post(
                        'userlogin',
                        data.field,
                        function (result) {
                           //  alert(JSON.stringify(result.user))
                            if (result.success) {
                                /*sessionStorage用于本地存储一个会话（session）中的数据，这些数据只有在同一个会话中的页面才能访问并
                                且当会话结束后数据也随之销毁。因此sessionStorage不是一种持久化的本地存储，仅仅是会话级别的存储。
                                而localStorage用于持久化的本地存储，除非主动删除数据，否则数据是永远不会过期的。*/
                                sessionStorage.setItem("User_Login",JSON.stringify(result.user));
                                window.location.href = "index.html";
                            }
                            else {
                                //location.reload();
                                $("#loginmsg").text('');
                                $("#loginmsg").append('账号或密码错误，登陆失败');
                            }
                        }
                    );
                    return false;
                });
            });
    })
</script>
<!-- 底部结束 -->
<script>
    //百度统计可去掉
    var _hmt = _hmt || [];
    (function () {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>
</body>
</html>